import {trim} from "@/utils/utils";
export function isFloat(number, length) {
    if (!isNaN(Number(number)) && (number+'').indexOf('.')>  -1) {
        if (length) {
            return (number+'').split('.')[1].length !== length ? false : true
        }
        return true
    }
    return false;
}
export function isInt(number){
    return  Number.isInteger(Number(number));
}
export function isNumber(num){
    return isFloat(num)||isInt(num)
}
export function isSpecialParam(value,length){
    if (length===0){
        return true;
    }
    if (value.length===0) {
        return false;
    }
    if(length===1){
        return (isFloat(value)||isInt(value));
    }
    if (length>1){
        value=trim(value);
        let nums=value.split(',');
        if (nums.length!==length){
            return false
        }
        console.log(nums)
        for (let i = 0; i < nums.length; i++) {
            if (!(isFloat(nums[i])||isInt(nums[i]))){
                return false;
            }
        }
        return true;
    }
}